home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 522 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.6 KB

  1. From: bglenden@colobus.aoc.nrao.edu (Brian Glendenning)
  2. Message-ID: <BGLENDEN.96Feb14173755@colobus.aoc.nrao.edu>
  3. X-Original-Date: 15 Feb 1996 00:37:55 GMT
  4. Path: in1.uu.net!bounce-back
  5. Date: 15 Feb 96 00:48:12 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: Exceptions and Destructors
  9. Organization: National Radio Astronomy Observatory, Socorro NM
  10. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  11.     iQBFAgUBMSKC2eEDnX0m9pzZAQF5SgF9ExuqbYWINgWIxUkNPxifhP36Ucnuwv2m
  12.     havOZ52jDXRV7qnTC8YVhydohY7sUuuA
  13.     =y6kM
  14.  
  15. As I understand it, an object is only considered constructed when its
  16. constructor has finished, so that an exception thrown from within that
  17. constructor will not result in that object's destructor being
  18. called. (Its completely constructed subobjects will be however).
  19.  
  20. What about the destructor? Is the object considered destructed when
  21. the destructor is *entered*, or when it *completes*?
  22.  
  23. struct foo : public other
  24. {
  25.     ~foo {throw("BAD?");}
  26. };
  27.  
  28. Since the above does not result in an infinite loop on the compilers I
  29. have access to, I presume that the object is considered destructed
  30. when the dtor is entered.
  31.  
  32. Questions:
  33.  
  34. Is this correct? Is it done this way to ensure in fact that infinite
  35. loops like the above won't happen? How do resources in "other" get
  36. released?
  37.  
  38. Thanks! -
  39.  
  40. Brian
  41.  
  42. -- 
  43.         Brian Glendenning - National Radio Astronomy Observatory
  44. bglenden@nrao.edu              Socorro NM               (505) 835-7347
  45. ---
  46. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  47.   Contact address: std-c++-request@ncar.ucar.edu.  Moderation policy:
  48.   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
  49.